Add HTTPX2Wrapper MVP#23883
Conversation
|
Codecov Report❌ Patch coverage is Additional details and impacted files🚀 New features to boost your workflow:
|
8a7b8bf to
559bd70
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f33a4ef93
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce35d7bb7f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
…-httpx2-wrapper-mvp
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-httpx2-wrapper-mvp
…-httpx2-wrapper-mvp
Validation Report
Run Passed validations (20)
|
e37930e
into
mwdd146980/httpx-migration-base
What does this PR do?
Adds an
HTTPX2Wrapperbacked by httpx2 behind ause_httpx2instance config flag. The default remainsRequestsWrapper. Also widens the OpenMetrics v2 scraper to catchHTTPConnectionErroralongsiderequests.exceptions.ConnectionError.Motivation/Why
Design validation for the migration RFC. httpx2 is the Pydantic-maintained successor to httpx. The goal is to land on a maintained library before any integration opts in.
Approach
HTTPX2Wrappersits alongsideRequestsWrapperindatadog_checks/base/utils/.AgentCheck.httpdispatches toHTTPX2Wrapperonly when the instance setsuse_httpx2: true. Otherwise it constructsRequestsWrapperexactly as before, so the default path is untouched.http_exceptionshierarchy. This translation runs only on the new engine's side:RequestsWrapperstill raises nativerequestsexceptions, so callers cannot yet rely on a single neutral contract regardless of backend. The OM v2 scraper works across both clients because it was explicitly taught to catch therequestsand httpx2 connection errors side by side. Full exception-contract unification across both backends is follow-up work, not part of this PR.HTTPResponseProtocolis widened withencoding(read + setter),url,cookies, andelapsed, plus@runtime_checkable, so both wrappers' response adapters expose the same surface. Existing callers that wrote throughresponse.encodingare now protocol-covered.(ConnectionError, HTTPConnectionError)so a streamed scrape fails the same way under either client.Verification
tests/base/utils/httpx2/covers verb dispatch, config/TLS/auth propagation, exception mapping, lifecycle/dispatch, the response adapter, and the OM scraper connection-error paths.ddev test -fs datadog_checks_basepasses (format + style clean).datadog_checks_basebase suite green except pre-existing kerberos/socks5 integration tests that require Docker (unrelated to this change).RequestsWrapperbehavior is unchanged: no integration setsuse_httpx2, so production callers are unaffected.Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged